package net.wangds.auth.utils;

import org.springframework.security.core.context.SecurityContextHolder;

/**
 * .
 * <p></p>
 *
 * @author 王东石 2020/5/15 21:19.
 */
public class SpringAuthUtils {

    public static String getCurrentUid(){
        String res;
        try {
            res = SecurityContextHolder.getContext().getAuthentication()
                    .getPrincipal().toString();
        }catch (Exception ex){
            res = null;
        }
        return res;
    }

}
